package draw.karcio;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Line2D;
import java.awt.geom.Rectangle2D;

import javax.swing.JComponent;

public class DrawComponent extends JComponent {
	/**
	 * 
	 */
	private static final long serialVersionUID = -895316536639381000L;

	public void paintComponent(Graphics g) {
		Graphics2D g2 = (Graphics2D) g;

		double leftX = 100;
		double topY = 100;
		double width = 200;
		double height = 150;

		Rectangle2D rectangle = new Rectangle2D.Double(leftX, topY, width,
				height);
		g2.draw(rectangle);

		Ellipse2D ellipse = new Ellipse2D.Double();
		ellipse.setFrame(rectangle);
		g2.draw(ellipse);

		g2.draw(new Line2D.Double(leftX, topY, leftX + width, topY + height));

		double centerX = rectangle.getCenterX();
		double centerY = rectangle.getCenterY();
		double radius = 150;
		
		Ellipse2D circle = new Ellipse2D.Double();
		circle.setFrameFromCenter(centerX, centerY, centerX+radius, centerY+radius);
		g2.draw(circle);

	}

}
